/*
package com.qk.interceptor;

import com.qk.utils.JwtUtils;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
@Component
@Slf4j
public class TokenInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
       //获取url地址，判断是否为登录，如果是登录，则放行
      */
/*  String requestURI = request.getRequestURI();
        if(requestURI.equals("/login")){
            log.info("登录请求:{},放行",requestURI);
            return true;
        }*//*

        //获取token
        String token = request.getHeader("token");
        // 判断token是否为空，如果为空，则返回401，如果不为空，则解析token
        if(token==null||token.equals("")){
            log.info("token不存在，返回401错误");
            response.setStatus(401);
            return false;
        }
        //解析token，如果解析失败，返回401错误
        try {
            JwtUtils.parseToken(token);
        }catch (Exception e){
            log.info("token解析失败，返回401错误");
            response.setStatus(401);
            return false;
        }
        //放行
        log.info("token验证成功，放行");
        return true;
    }
}
*/
